"use client"
import { LayoutProps } from "@/types/LayoutProps"
import { Container, ContextMenu, Flex, Link } from "@radix-ui/themes"


const AdminLayout = ({ children }: LayoutProps) => {
    const menu: { label?: string, href?: string, title?: string }[] = [{
        label: "首页",
        href: "/"
    }, {
        label: "用户列表",
        href: "/user"
    }, {
        label: "文章列表",
        href: "/article"
    }]
    return (
        <Container>
            <Flex className="mt-2 p-1" gap="2">
                <Flex className="w-36">
                    <div className="w-full pl-1 shadow">
                        {menu.map(({ title, label, href }, key) => {
                            if (!!title) return (
                                <div className="leading-8" key={key}>
                                    {title}
                                </div>
                            )
                            return (
                                <div className="leading-8" key={key}>
                                    <Link href={`/admin${href}`}>
                                        {label}
                                    </Link>
                                </div>
                            )
                        })}
                    </div>
                </Flex>
                <Flex>
                    {children}
                </Flex>
            </Flex>
        </Container>
    )
}
export default AdminLayout